<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        body{
            width: 100%;
            
        }
        div{
            width: 100px;
            height: 50px;
            border: 1px solid #000;
        }
        ul,button{
            display: block;
        }
    </style>
</head>
<body>
    <div id="app" >
        <button v-on:click = "age++">增加--{{age}}</button>
        <div v-text="age"></div>
        <div v-html="text"></div>
        <div v-pre>{{ name }}</div>
        <ul>
            <li v-for="(item,index) of str">{{item}},{{index}}</li>
        </ul>
        <div :style="{color:cor}">我是bind</div>
        <div :style="sty">我是bind2</div>
        <div>
            <div v-if="flag">{{name}}</div>
            <div v-show="flag">{{age}}</div>
            <button @click = "flag = !flag">切换</button>
        </div>
    </div>
</body>
</html>
<script>
    //指令
    //v-on 指令 ：用于 监听 事件
        // v-on:click
        // 简写：@click
    const { createApp } = Vue
    const app = createApp({
        data(){
            return{
                name:'ming',
                age:18,
                text:'<p>新的 vue</p>',
                str:[1,2,3,4,5],
                flag:true,
                cor:'red',
                sty:{
                    backgroundColor:'green',
                    color:'red'
                }
            }
        }
    })
    app.mount('#app')
</script>